var setting = {
    view: {
        dblClickExpand: false,
        selectedMulti: false,
        fontCss:{fontSize:"16px"}
    },
    data: {
        simpleData: {
            enable: true
        }
    },
    callback: {
        onClick: onClick
    }
};
function onClick(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj("tree"),
    nodes = zTree.getSelectedNodes();
    // alert(nodes.length);
    if (nodes.length > 0) {
        var id = nodes[0].id;
    }

    cityObj.attr({"value": nodes[0].name,'tid':id});
    var cl = '.'+(cityObj.attr('id'));
    //alert($(cl).attr('name'));
    $(cl).val(id);
    $("#menuContent").hide();

}

function showMenu(obj) {
    cityObj = obj;
    var cityOffset = obj.offset();
    $("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px","z-index":9999}).slideDown("fast");

    $("body").bind("mousedown", onBodyDown);
}
function hideMenu() {
    $("#menuContent").fadeOut("fast");
    $("body").unbind("mousedown", onBodyDown);
}
function onBodyDown(event) {
    if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
        hideMenu();
    }
}
